import { createStore, createLogger } from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import user from "@/store/module/user";
import tabs from "@/store/module/tabs";

/* 使用插件 */
const plugins = [
  createPersistedState({
    paths: ['tabs.history'],
  }),
]
const env = import.meta.env.MODE
if (env === 'development') plugins.push(createLogger())

/* 创建store */
const store = createStore({
  plugins,
  strict: true,
  state: {},
  mutations: {
    clearVuex(state){
      state.user.profile = null
    }
  },
  actions: {},
  modules: {
    user,
    tabs
  },
})
export default store
